import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SmsChannelVO, SmsChannelForm, SmsChannelQuery } from '@/api/sms/channel/types';

/**
 * 查询邮件渠道列表
 * @param query
 * @returns {*}
 */

export const listSmsChannel = (query?: SmsChannelQuery): AxiosPromise<SmsChannelVO[]> => {
  return request({
    url: '/sms/channel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询邮件渠道详细
 * @param id
 */
export const getSmsChannel = (id: string | number): AxiosPromise<SmsChannelVO> => {
  return request({
    url: '/sms/channel/' + id,
    method: 'get'
  });
};

/**
 * 新增邮件渠道
 * @param data
 */
export const addSmsChannel = (data: SmsChannelForm) => {
  return request({
    url: '/sms/channel',
    method: 'post',
    data: data
  });
};

/**
 * 修改邮件渠道
 * @param data
 */
export const updateSmsChannel = (data: SmsChannelForm) => {
  return request({
    url: '/sms/channel',
    method: 'put',
    data: data
  });
};

/**
 * 删除邮件渠道
 * @param id
 */
export const delSmsChannel = (id: string | number | Array<string | number>) => {
  return request({
    url: '/sms/channel/' + id,
    method: 'delete'
  });
};
